package com.acme.bankapp.service.bank;

import com.acme.bankapp.domain.bank.*;

public class BankApplication {

	private static Bank bank = new Bank();

	public static void modifyBank() {

		bank.clients[0].chacc.deposit(16);
		bank.clients[0].sacc.withdraw(455);

	}


	public static void printBalance() {

		int length = bank.clients.length;
		for (int i = 0; i < length; i++) {
			if (bank.clients[i] == null) {
				break;
			}
			
			if (bank.clients[i].sacc != null) {
				System.out.printf("Client #%d || FIO:  %s || Balance: %.2f\n", i + 1, bank.clients[i].getClientSalutation(), bank.clients[i].sacc.getBalance());
			}
			if (bank.clients[i].chacc != null) {
				System.out.printf("Client #%d || FIO:  %s || Balance: %.2f\n", i + 1, bank.clients[i].getClientSalutation(), bank.clients[i].chacc.getBalance());
			}

		}
	}
	
	public static void main(String[] args) {
	

		BankService.addClient(bank, new Client("Kolobkova Ira", Gender.Female));
		bank.clients[0].sacc = new SavingAccount(123456.024);
		bank.clients[0].chacc = new CheckingAccount(1.5, 2);
		


		BankService.addClient(bank, new Client("Toporov Ivan", Gender.Male));
		bank.clients[1].sacc = new SavingAccount(456.024);


		BankService.printMaximumAmountToWithdraw(bank);
		printBalance();
		modifyBank();
		System.out.printf("------------------------------------------Modify-------------------------------------\n");

		printBalance();
	}

}